
<%--
 *  File:    ActivityConfigSummary.jsp
 *  @Author: liangchen
 *  Date:    2009/06/05
 *
 *  Copyright (C) 2000 - 2009 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<%
  //init param
  String strTableName = "v_activityconfig";
  String strModuleName = "CRM";
  String privilegeCode = "SFE0170";
  String contextPath = request.getContextPath();  
%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>VisitProcessSummary</title>
<PageFlow:CheckPageFlow pageName="p_activityconfigsummary"/>
<%
	String isNew = "";
	String isDefault = "";
	String paraIsDefault = "";
	//System.out.println("Trace \"isdefault\" ------- summary" + ((String)pageContext.getAttribute("isdefault")));
	if("Y".equals(((String)pageContext.getAttribute("isdefault")))||"Y".equals(request.getParameter("isdefault"))) {
		isDefault = "&isdefault=Y";
		paraIsDefault="Y";
	}else if("N".equals(((String)pageContext.getAttribute("isdefault")))||"Y".equals(request.getParameter("isdefault"))) {
		isDefault = "&isdefault=N";
		paraIsDefault="N";
	}
	
	  HashMap userinfo = new HashMap();
	  userinfo = (HashMap)session.getAttribute("userinfo");
	  Integer orgid=new Integer(-1);
	  if(userinfo.get("userid")!=null)
	  orgid = (Integer)userinfo.get("userid");
	
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<iframe name="reloadHandler" style="display:none" ></iframe>
<script>


function clickRow(id,status,userid)
{
  document.frm.activityconfigid.value = id;

  document.frm.status.value = status;
  document.frm.userid.value = userid;
}
function page_new()
{
	<%isNew = "&isNew=Y";%>
   location.href="ActivityFrm.jsp?<%= OvalTools.randomURL() %><%=JspHelper.filterNull(isDefault)%><%=JspHelper.filterNull(isNew)%>";
}
function page_delete()
{	
	if(isEmpty(document.frm.activityconfigid.value) || document.frm.activityconfigid.value == -1)
	{
		return;
	}
	if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE") %>") )  return;

	 var from = document.frm;
	 from.actionname.value = "del";
	 from.target = "_self";
	   isRunning = true;
	   from.submit();
}
function page_edit()
{
  var id = document.frm.activityconfigid.value;
  
  var editurl;

  if(id == null || id.length == 0 || id == "" || id == "-1")
  {
    alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
    return;
  }

  var userid = document.frm.userid.value; 
  var orgid = document.frm.orgid.value;
  if(userid!=orgid){
	    alert("不是创建人,不允许编辑!");
	    return;
	}

	<%isNew = "&isNew=N";%>
    
	editurl = "ActivityFrm.jsp?<%= OvalTools.randomURL() %><%=JspHelper.filterNull(isDefault)%>&activityconfigid=" + id + "&languagecode=" + "<%= strLanguageCode %><%=JspHelper.filterNull(isNew)%>";
	
    self.location.href = editurl;
}
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(frm,actionvalue,orderbyname);
  editform.action = "ActivityConfigSummary.jsp?<%= OvalTools.randomURL() %><%=JspHelper.filterNull(isDefault)%>&languagecode=<%= strLanguageCode %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}
</script>
</head>
<body>

<form name="frm" method="post" action="<%= contextPath %>/Dispatcher" target="_parent">
<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
   
      <input type="hidden" name="pagename" value="p_activityconfigsummary">
      
      <input type="hidden" name="actionname">   
      <input type="hidden" name="isdefault" value="<%= paraIsDefault %>">
      <input type="hidden" name="orgid" value="<%= orgid %>">   
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0">
        <tr> 
          <td class="summary_top" colspan="3" ></td>
        </tr>
        <tr>
          <td>    
            <table border="0" cellspacing="0">    
            <%@ include file="/inc/SummarySearch.inc" %>  
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td> 
      <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">
          <tr class="deepblue-left">
<td width="2%" class="title_center">&nbsp;</td>
            <td width="8%" class="title_center"><a href="javascript:page_summary('orderby','activityconfigcode')"><%= label.getLabelName("L_Mactivity")+label.getLabelName("L_IntervalType")+label.getLabelName("L_GroupNumber") %></a></td>           
            <td width="8%" class="title_center"><a href="javascript:page_summary('orderby','activityconfigname')"><%= label.getLabelName("L_Mactivity")+label.getLabelName("L_IntervalType")+label.getLabelName("L_Name") %></a></td>
            <td width="8%" class="title_center"><a href="javascript:page_summary('orderby','statusname')"><%= label.getLabelName("L_Status") %></a></td>
            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','employeename')"><%= label.getLabelName("L_Maker")%></a></td>
            <td width="8%" class="title_center"><a href="javascript:page_summary('orderby','createdate')"><%= label.getLabelName("L_CreatDate") %></a></td>
            <td width="16%" class="title_center"><a href="javascript:page_summary('orderby','comments')"><%= label.getLabelName("L_Comments") %></a></td>
            <!-- 
            <td width="8%" class="title_center"><a href="javascript:page_summary('orderby','createdate')"><%= label.getLabelName("L_VisitProcessType") %></a></td>
             -->
</tr>
          <%
             Vector visitprocessSummary1 = (Vector)pageContext.getAttribute("visitprocesssummary");
             if(visitprocessSummary1 == null)
             {
               visitprocessSummary1 = new Vector();
             }
             String strClassType = new String("");   
             Integer nDefaultId = null;             
             Integer nDefaultStatus = null;
             Integer nDefaultUserid = null;
             Integer nDefaultVersion = new Integer(-1);
             int i=0;
             String strChecked = "";
             boolean bHasChecked = false;
          %>   
          <logic:iterate id="visitprocessSummary" collection="<%= visitprocessSummary1 %>">
          <%
            if(i%2 == 1)
            {
              strClassType = "td-listrom";
            }else{                    
              strClassType = "none";
            }
            if(!bHasChecked)
            {
              nDefaultId = (Integer)(((HashMap)pageContext.getAttribute("visitprocessSummary")).get("activityconfigid"));
              nDefaultStatus =  (Integer)(((HashMap)pageContext.getAttribute("visitprocessSummary")).get("status"));   
              nDefaultUserid =  (Integer)(((HashMap)pageContext.getAttribute("visitprocessSummary")).get("userid"));
              bHasChecked = true;
              strChecked = "Checked";
            }
            else
            {
              strChecked = "";
            }
            i++;
          %>            
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  onClick="radiotrue('activityconfigid<%=JspHelper.filterNull( i )%>');
			    javascript:clickRow('<oval:write name="visitprocessSummary" property="activityconfigid" />', 
			                        '<oval:write name="visitprocessSummary" property="status" />',
			                        <oval:write name="visitprocessSummary" property="userid" />);"     
          class="<%=JspHelper.filterNull( strClassType )%>"> 
            <td> 
              <input <%=JspHelper.filterNull( strChecked )%> id="activityconfigid<%=JspHelper.filterNull( i )%>" type="radio" name="order" value="<oval:write name="Summaryitem" property="activityconfigid"/>" class="normalradio"/>
            </td>       
            <td class="hand"><a href="ActivityFrmInfo.jsp?<%= OvalTools.randomURL() %><%=JspHelper.filterNull(isDefault)%>&activityconfigid=<custom:write name="visitprocessSummary" property="activityconfigid"/>"><custom:write name="visitprocessSummary" property="activityconfigcode" nbsp="true"/></a></td>
            <td><custom:write name ="visitprocessSummary" property="activityconfigname" nbsp="true"/></td>
            <td><custom:write name="visitprocessSummary" property="statusname" nbsp="true"/></td>
            <td><custom:write property="employeename" name="visitprocessSummary" nbsp="true" /></td>
            <td><custom:write name="visitprocessSummary" property="createdate" dataType="date" dataFormatName="dateformat" nbsp="true"/></td>
            <td><custom:write name="visitprocessSummary" property="comments" nbsp="true"/></td>
            <!-- 
             <td><custom:write name="visitprocessSummary" property="visitprotypename" nbsp="true"/></td>
             -->
          </tr>
          </logic:iterate> 
        <%
            String history=(String)pageContext.getAttribute("history");
        %> 
        <input type="hidden" name="activityconfigid" value="<%=JspHelper.filterNull( nDefaultId )%>">  
        <input type="hidden" name="status" value="<%=JspHelper.filterNull( nDefaultStatus )%>"> 
        <input type="hidden" name="userid" value="<%=JspHelper.filterNull( nDefaultUserid )%>"> 
            
        <%@ include file="/inc/SummaryAction.inc" %>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top" ></td>
        </tr>
        <tr>
        
          <td class="td_center">
           <%if(history==null||history.trim().equals("")){%>
              <a onclick="page_new()"><custom:button type="1" label="L_New" imgsrc="new.gif" border="0" style="width:60"/></a>
              <%if(pageContext.getAttribute("visitprocessSummary")!=null){%>
              <a onclick="page_edit()"><custom:button type="1" label="L_Edit" imgsrc="edit.gif" border="0" style="width:60"/></a>
              <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
              <%}%>
           <%}else{%>
           <a onclick="page_back()"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a>
          <%}%>
        
          </td>
        </tr>
      </table>
    </td>
  </tr>

</table>
 </form>
</body>
</html>
